<script type='text/javascript' src="<{$xoops_url}>/modules/xanhte/js/lib/prototype.js"></script>
<div class='content'>

<h4><{$smarty.const._MI_XANHTE_GPERM_OF|sprintf:$app.mod.name.value}></h4>
<form name='groupperm_form_post' id='groupperm_form_post' action='./index.php' method='post'>
<input type='hidden' name='dirname' value='<{$form.dirname}>' />
<input type='hidden' name='action_admin_gperm_do' value='1' />
<table width='100%' class='outer' cellspacing='1'>
<{foreach from=$app.gperm item=gperm}>
	<tr><th colspan="2"><{$gperm.desc}></th></tr>
	<{foreach from=$gperm.itemid key=itemid item=itemtitle}>
	<tr valign='top' align='left'>
		<td class='head'><{$gperm.itemname}>&raquo;&raquo;<{$itemtitle}></td>
		<td class='even'>
			<table class="outer">
				<tr>
					<{foreach from=$app.groups item=group name=grouploop}>
					<td class="odd">
						<input type="checkbox" name="gperm[<{$gperm.name}>.<{$itemid}>.<{$group.groupid}>]" value="1" id="<{$gperm.name}>_<{$itemid}>_<{$group.groupid}>" />
						<label for="<{$gperm.name}>_<{$itemid}>_<{$group.groupid}>"><{$group.name}></label>
					</td>
					<{if $smarty.foreach.grouploop.iteration%4 == 0}></tr><tr><{/if}>
					<{/foreach}>
				</tr>
			</table>
		</td>
	</tr>
	<{/foreach}>
<{/foreach}>
	<tr valign='top' align='left'><td class='head'>&nbsp;</td>
		<td class='even'>
			<input type='button' class='formButton' name='none'  id='none' value='<{$smarty.const._NONE}>' onclick="with(document.groupperm_form_post){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}" />&nbsp;
			<input type='button' class='formButton' name='all'  id='all' value='<{$smarty.const._ALL}>' onclick="with(document.groupperm_form_post){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}" />
		</td>
	</tr>
	<tr valign='top' align='left'>
		<td class='head'></td>
		<td class='even'>
			<input type='reset' class='formButton' name='reset'  id='reset' value='<{$smarty.const._CANCEL}>' />&nbsp;
			<input type='submit' class='formButton' name='submit'  id='submit' value='<{$smarty.const._SUBMIT}>' />
		</td>
	</tr>
</table>
</form>
</div>
<script>
Event.observe(window, 'load', function(){
	var check_ids = [<{foreach from=$app.g_checked item=id}>'<{$id}>',<{/foreach}>''];
	for (var i=0; i<check_ids.length; i++){
		id = check_ids[i];
		if($(id) && $(id).type=="checkbox"){
			$(id).checked = true;
		}
	}
});
</script>
